package org.dreamwork.tools.network.bridge.client.fx.views;

import javafx.scene.control.ListCell;
import org.dreamwork.tools.network.bridge.client.data.Proxy;

/**
 * Created by seth.yang on 2020/3/10
 */
public class ProxyCell extends ListCell<Proxy> {
    @Override
    protected void updateItem (Proxy proxy, boolean empty) {
        super.updateItem (proxy, empty);
/*
        int index = this.getIndex ();
        System.out.printf (
                "ListItem[%d] update item，device = %s, empty = %s%n" +
                "the old view = %s%n",
                index,
                device,
                empty,
                getGraphic ()
        );
*/

        if (!empty && proxy != null) {
            setGraphic (new ProxyView (proxy));
//            setGraphic (new DeviceItemView (proxy, listener));
        } else {
            setGraphic (null);
            setText (null);
        }
    }
}
